package games.mapacman.client;

import games.mapacman.common.consts;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class PanelKeyListener implements KeyListener {

	private MaPacman client;
	
	public PanelKeyListener(MaPacman client)
	{
		this.client=client;
	}
	
	public void keyTyped(KeyEvent arg0) {
	}

	public void keyPressed(KeyEvent arg0) {
	}

	public void keyReleased(KeyEvent arg0) {
		switch (arg0.getKeyCode()){
			case 37 : client.changeDirection(consts.DIR_WEST); break;
			case 38 : client.changeDirection(consts.DIR_NORTH);break;
			case 39 : client.changeDirection(consts.DIR_EAST);break;
			case 40 : client.changeDirection(consts.DIR_SOUTH);break;
		}
		

	}

}
